package com.proton.carepatchtemp.fragment;

import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.proton.carepatchtemp.R;
import com.proton.carepatchtemp.base.BaseFragment;
import com.proton.carepatchtemp.ui.CenterTextView;
import com.proton.carepatchtemp.utils.eventbus.MainEvent;

public class UseDirection3Fragment extends BaseFragment {
    private CenterTextView mTvUseDirection4;

    public UseDirection3Fragment() {
    }

    public static UseDirection3Fragment newInstance() {
        return new UseDirection3Fragment();
    }

    @Override
    public void dealEvent(MainEvent event) {

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_use_direction3, container, false);
        initView(view);

        String html = "4、将胶贴“皮肤面”保护膜撕开，轻轻贴于紧靠宝宝腋窝处。为保证测温准确，需保证体温贴表面“" + "<img src='" + R.drawable.use_direction_circle + "'/>" + "”标识位于腋窝中心位置";
        Html.ImageGetter imgGetter = source -> {
            int id = Integer.parseInt(source);
            Drawable d = getResources().getDrawable(id);
            d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
            return d;
        };
        CharSequence charSequence = Html.fromHtml(html, imgGetter, null);
        mTvUseDirection4.setText(charSequence);

        return view;
    }

    @Override
    public void onEventMainThread(MainEvent event) {

    }

    private void initView(View view) {
        mTvUseDirection4 = view.findViewById(R.id.tv_use_direction4);
    }
}
